package com.example.lxc415billiards.service.Impl;

import com.example.lxc415billiards.domain.BilliardTable;
import com.example.lxc415billiards.mapper.BilliardTableMapper;
import com.example.lxc415billiards.service.BilliardTableService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class BilliardTableServiceImpl implements BilliardTableService {

    @Autowired
    private BilliardTableMapper billiardTableMapper;

    @Override
    public List<BilliardTable> getAllTables() {
        return billiardTableMapper.selectAllTables();
    }

    @Override
    public BilliardTable getTableById(int tableId) {
        return billiardTableMapper.selectTableById(tableId);
    }

    @Override
    public BilliardTable addTable(BilliardTable table) {
        billiardTableMapper.insertTable(table);
        return table;
    }

    @Override
    public void deleteTableById(int tableId) {
        billiardTableMapper.deleteTableById(tableId);
    }

    @Override
    public BilliardTable updateTable(BilliardTable table) {
        billiardTableMapper.updateTable(table);
        return table;
    }
}
